/**
 * 
 */
package com.mindtree.vi.business.questionsubmission;

import java.util.List;

import org.springframework.beans.factory.annotation.Required;
import org.springframework.transaction.annotation.Transactional;

import com.mindtree.vi.dbaccess.datatypes.problem.Problem;
import com.mindtree.vi.dbaccess.manager.problem.ProblemTableManager;

/**
 * @author venkatesh
 * 
 */
@Transactional
public class SimpleQuestionManager implements QuestionManager {

	private ProblemTableManager problemTableManager;

	@Required
	public void setProblemTableManager(ProblemTableManager problemTableManager) {
		this.problemTableManager = problemTableManager;
	}

	public Problem submitQuestion(final Problem problem) {
		return problemTableManager.save(problem);
	}

	public Problem findQuestion(final long problemId) {
		return problemTableManager.find(problemId);
	}

	public List<Problem> findAllQuestions() {
		return problemTableManager.findAll();
	}

	public boolean authenticate(String emailId, String password) {
		// TODO Auto-generated method stub
		return false;
	}
	public boolean approveQuestion(Problem problem){
		problem.setIsReviewed("T");
		problem = problemTableManager.save(problem);
		return (problem.isReviewed().equals("T")?true:false);
	}


}
